|
|
|
|
|
|
|
New York, California, and Alaska, you could use the IN keyword followed by the desired values, separated by commas, within parenthesis, as part of the WHERE clause. Enter and execute the following SQL statement, and check your results against those shown in Figure 8.9. |
|
|
|
|
|
|
|
|
SELECT PubID, Name, City, StateProv FROM Publishers
WHERE StateProv IN ('NY','CA','RI') |
|
|
|
|
|
|
|
|
Figure 8.9.
Using the IN keyword in the WHERE clause. |
|
|
|
|
|
|
|
|
You can also use the LIKE function to return all rows whose columns' contents are similar to the literals passed in the function. For example, to return all rows with a StateProv column that has the letter A in any position, you would use the following SQL SELECT_FROM statement (see Figure 8.10 for results): |
|
|
|
|
|
|
|
|
SELECT PubID, Name, City, StateProv FROM Publishers
WHERE StateProv LIKE('*I*') |
|
|
|
|
|
|
|
|
Figure 8.10.
Using the LIKE function in a WHERE clause. |
|
|
|
|
|